@use '@scss/common' as *;

.drawer {
  display: flex;
  overflow: hidden;
  position: fixed;
  height: 100vh;
  background-color: transparent;
}

.blurBG {
  @include blur-bg();
  & {
    position: absolute;
    z-index: 1;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    opacity: 0;
    transition: all 300ms ease-out;
  }
}

.content {
  opacity: 0;
  transform: translateX(#{4rem});
  position: relative;
  z-index: 2;
  width: 100%;
  transition: all 300ms ease-out;
  overflow: hidden;
  background-color: var(--theme-bg);
  @include data-theme-selector('dark') {
    background-color: var(--theme-elevation-50);
  }
}

.contentChildren {
  position: relative;
  z-index: 1;
  overflow: auto;
  height: 100%;
  padding: calc(var(--header-height) + 4rem) var(--gutter-h) 4rem 4rem;

  @include mid-break {
    padding: calc(var(--header-height) + 5rem) 1.5rem 1.5rem 1.5rem;
  }
}

.isOpen {
  &:local() {
    .content,
    .blurBG,
    .close {
      opacity: 1;
    }

    .close {
      transition: opacity 300ms ease-in-out;
    }

    .content {
      transform: translateX(0);
    }
  }
}

.close {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  text-indent: -9999px;
  background: rgba(0, 0, 0, 0.08);
  cursor: pointer;
  opacity: 0;
  will-change: opacity;
  transition: none;
  transition-delay: 0ms;
  border: none;
  outline: none;

  &:active,
  &:focus {
    outline: 0;
  }
}

.header {
  display: flex;
  align-items: flex-start;
  margin-bottom: 2rem;
  width: 100%;
}

.headerContent {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  width: 100%;
  gap: 1rem;
}

.description {
  color: var(--theme-elevation-500);
  margin: 0;
}

.title {
  margin: 0 1rem 0 0;
  flex-grow: 1;
}

.headerClose {
  border: 0;
  background-color: transparent;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  top: 10px;
  min-width: fit-content;
  color: var(--theme-elevation-950);

  &:focus-visible {
    @include outline;
  }

  @include mid-break {
    top: 2px;
  }
}

.size-l {
  .close {
    width: var(--gutter-h);
  }
}

.size-m {
  .contentChildren {
    padding: 4rem;
  }

  .close {
    width: 20vw;
  }
}

.size-s {
  .contentChildren {
    padding: 4rem;
  }

  .close {
    width: 40vw;
  }

  @include mid-break {
    .contentChildren {
      padding: 3rem;
    }

    .header {
      margin-bottom: 1rem;
    }

    .close {
      width: 20vw;
    }
  }
}

@include small-break {
  .size-l,
  .size-m,
  .size-s {
    .close {
      width: var(--gutter-h);
    }
  }
}
